
// pages/metest/metest.js
let app = getApp();
Component({

  /**
   * 页面的初始数据
   */
  data: {
    barIndex: app.globalData.barIndex,
    select: 0,
    "color": "#bbbcbd",
    "selectedColor": "#3753DA",
    "backgroundColor": "#FEFFFF",
    "borderStyle": "white",
    "list":[
    ]
},

methods: {
  selectPage(e) {
    let that =this
    const  idx = e.currentTarget.dataset.index
    const path = e.currentTarget.dataset.page
    wx.switchTab({
      url: path
    })
    // that.setData({
    //   select: -
    // })
    // app.globalData.barIndex = idx
    wx.setStorageSync('barIndex', idx)
    // if(idx == 1){
    //   list[1].info = 0
    // }
  },
},
lifetimes: {
  attached: function() {
    // 在组件实例进入页面节点树时执行
  },
  detached: function() {
    // 在组件实例被从页面节点树移除时执行
  },
},
pageLifetimes: {
  load: function (){
  },
  show:  function () {
    // 页面被展示
    let that = this
    let type=wx.getStorageSync('type')
    let index = wx.getStorageSync('barIndex')
    let isdriver =wx.getStorageSync('isdriver')
    if(isdriver==0 && type==1){
      that.setData({
        list:[
          {
            "pagePath": "/pages/homePage/homePage",
            "text": "首页",
            "iconPath": "/image/ssh.png",
            "selectedIconPath": "/image/ssl.png"
          },
          {
            "pagePath": "/pages/bidPrice/bidPrice",
            "text": "竞价",
            "iconPath": "/image/jjh.png",
            "selectedIconPath": "/image/jjl.png"             
          }, 
          {
            "pagePath": "/pages/my/my",
            "text": "个人中心",
            "iconPath": "/image/myh.png",
            "selectedIconPath": "/image/myl.png"
          }
        ]
      })
    }else if(isdriver==1 && type==1){
      that.setData({
        list:[
          {
            "pagePath": "/pages/homePage/homePage",
            "text": "首页",
            "iconPath": "/image/ssh.png",
            "selectedIconPath": "/image/ssl.png"
          },
          {
            "pagePath": "/pages/my/my",
            "text": "个人中心",
            "iconPath": "/image/myh.png",
            "selectedIconPath": "/image/myl.png"
          }
        ]
      })
    }else{
      that.setData({
        list:[
          {
            "pagePath": "/pages/materialFlow/materialFlow",
            "text": "首页",
            "iconPath": "/image/ssh.png",
            "selectedIconPath": "/image/ssl.png"
          },
          {
            "pagePath": "/pages/my/my",
            "text": "个人中心",
            "iconPath": "/image/myh.png",
            "selectedIconPath": "/image/myl.png"
          }
        ]
      })
    }
    
    that.setData({
      select: index
    })
   
  },
  hide: function() {
    // 页面被隐藏
  },
  resize: function(size) {
    // 页面尺寸变化
  }
},

  /**
   * 生命周期函数--监听页面加载
   */


  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady() {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow() {

  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide() {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload() {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh() {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom() {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage() {

  }
})